﻿package com.content.model.LoadedAssets
{

    import org.puremvc.as3.interfaces.IProxy;
    import org.puremvc.as3.patterns.proxy.Proxy;
    import org.puremvc.as3.utilities.startupmanager.model.StartupResourceProxy;
  
    public class EntityProxy extends Proxy implements IProxy
    {
		/**
		 * This proxy class isn’t instantiated and registered with the application itself, 
		 * it only serves as a helper class for the actual resource proxies. 
		 * The resource proxies extend EntityProxy and implement IStartupProxy. 
		 * This way they become part of both contexts.
		 */
        public function EntityProxy( name :String, data:Object ) 
		{
            super( name, data );
        }
		
		/**
		 * This method is a helper function that is used by the actual resource proxies to send “Loaded” or “Failed” notifications. 
		 * These notifications are only sent if the Startup Manager hasn’t timed out the resource.
		*/
        protected function sendLoadedNotification( noteName:String, noteBody:String, srName:String ):void 
		{
            var srProxy:StartupResourceProxy = facade.retrieveProxy( srName ) as StartupResourceProxy;
            if ( ! srProxy.isTimedOut() )
			{
                sendNotification( noteName, noteBody );
			}
        }

    }
}